#######------------------------------------------------------------
# CORD Demo
# =========

export LISTENPORT=8080
export JETTY="-jar jetty-runner.jar"
export CORD=./cord-gui-1.6.0.war
export LOGDBG=-Dorg.onosproject.cord.gui.LEVEL=DEBUG
export DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n"
export LOG=cord.log

DBG=""
if [ "$1" = "debug" ]
then
    shift
    DBG=$DEBUG
fi

IP="$1"
PORT="$2"

if [ ! -z "$IP" ]
then
  PARAM1="-Dheadnodeip=$IP"
else
  PARAM1=""
fi

if [ ! -z "$PORT" ]
then
  PARAM2="-Dheadnodeport=$PORT"
else
  PARAM2=""
fi

java $PARAM1 $PARAM2 $LOGDBG $DBG $JETTY --port $LISTENPORT $CORD >$LOG 2>&1 &

echo jetty-runner started {$PARAM1:$PARAM2}
echo .. logging to $LOG
